@extends('admin.main')
@section('head')
    <link href="/static/datetimepicker/css/datetimepicker.css" rel="stylesheet" type="text/css">
    @if(C('COLOR_STYLE')=='blue_color')
        <link href="/static/datetimepicker/css/datetimepicker_blue.css" rel="stylesheet" type="text/css">'@endif
    <link href="/static/datetimepicker/css/dropdown.css" rel="stylesheet" type="text/css">
    <script type="text/javascript" src="/static/datetimepicker/js/bootstrap-datetimepicker.min.js"></script>
    <script type="text/javascript" src="/static/datetimepicker/js/locales/bootstrap-datetimepicker.zh-CN.js"
            charset="UTF-8"></script>
@endsection
@section('body')
    <!-- 标题栏 -->
    <div class="main-title">
        <h2>续费记录</h2>
    </div>
    <div class="cf">
        <div class="fl">
        </div>

        <!-- 高级搜索 -->
        <div class="search-form fr cf">
            <!-- 高级搜索 -->
            <div class="search-form fr cf">
                <div class="sleft">
                    <input type="text" name="keyword" class="search-input" value="{{isset($_GET['keyword']) ? $_GET['keyword'] : ''}}"
                           placeholder="请输入订单号">
                    <a class="sch-btn" href="javascript:;" id="search"
                       url="{{urlAdmin('shop','getChargeRecord')}}"><i
                                class="btn-search"></i></a>
                </div>
            </div>
            <div class="btn-group-click adv-sch-pannel fl">
                <button class="btn">高 级<i class="btn-arrowdown"></i></button>
                <div class="dropdown cf">
                    <div class="row">
                        <label>续费时间：</label>
                        <input type="text" id="time-start" name="time-start" class="text input-2x" value="{{request('time-start')}}" placeholder="起始时间" /> -
                        <input type="text" id="time-end" name="time-end" class="text input-2x" value="{{request('time-end')}}" placeholder="结束时间" />
                    </div>
                </div>
            </div>
        </div>
    </div>
    <!-- 数据列表 -->
    <div class="data-table table-striped">
        <table class="">
            <thead>
            <tr>
                <th class="row-selected row-selected"><input class="check-all" type="checkbox"/></th>
                <th class="">订单号</th>
                <th class="">店铺名</th>
                {{--<th class="">套餐名</th>--}}
                <th class="">资费类目</th>
                <th class="">续费年限 (年)</th>
                <th class="">续费金额 (元)</th>
                <th class="">订单状态</th>
                <th class="">下单时间</th>
            </tr>
            </thead>
            <tbody>
            @if(count($rows['data']))
                @foreach($rows['data'] as $v)
                    <tr>
                        <td><input class="ids" type="checkbox" name="ids[]" value="{{$v['id']}}"/></td>
                        <td>{{$v['order_sn']}}</td>

                        <td>{{$v['shop']['shop_name']}}</td>
                        {{--<td>{{$v['service']['name']}}</td>--}}
                        <td>{{$v['category'] ? '基础服务费' : '店铺服务费'}}</td>
                        <td>{{$v['time']}}</td>
                        <td>{{$v['order_amount']}}</td>
                        <td>
                            <span style="color:@if($v['status'] == 10) red @else blue @endif">{{$v['status_text']}}</span>
                        </td>
                        <td>{{$v['created_at']}}</td>
                    </tr>
                @endforeach
            @else
                <td colspan="12" class="text-center"> aOh! 暂时还没有内容!</td>
            @endif
            </tbody>
        </table>
    </div>
    <div class="page">
        @if($rows['last_page']>1)
            <div>
                @if($rows['prev_page_url'])
                    <a class="prev" href="{{$rows['prev_page_url']}}&admin_id={{$rows['data'][0]['admin_id']}}">
                        &lt;&lt;</a>
                @endif
                @if(count($rows['pageNoList']))
                    @foreach($rows['pageNoList'] as $v)
                        @if($rows['current_page'] == $v)
                            <span class="current">{{$v}}</span>
                        @else
                            <a class="num"
                               href="{{urlAdmin('shop','getChargeRecord',['page'=>$v,'admin_id'=>$rows['data'][0]['admin_id']])}}">{{$v}}</a>
                        @endif
                    @endforeach
                @endif
                @if($rows['next_page_url'])
                    <a class="next" href="{{$rows['next_page_url']}}&admin_id={{$rows['data'][0]['admin_id']}}">
                        &gt;&gt;</a>
                @endif
                <span class="rows">共 {{$rows['total']}} 条记录</span>
            </div>
        @endif
    </div>
@endsection

@section('script')

    <script type="text/javascript">

        function addGood(shop_id, bucket_category_id) {
            if (!(shop_id && bucket_category_id)) {
                layer.tips('非法操作', '#msg', {
                    tips: [1, 'orange'],
                    time: 4000
                });
            } else {
                window.location.href = '{{urlAdmin('bucket','getAddLog',['shop_id'=>request('shop_id'),'bucket_category_id' =>request('bucket_category_id')])}}'
            }
        }

        //搜索功能
        $("#search").click(function () {
            var url = $(this).attr('url');
            var query = $('.search-form').find('input').serialize();
            query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g, '');
            query = query.replace(/^&/g, '');
            if (url.indexOf('?') > 0) {
                url += '&' + query;
            } else {
                url += '?' + query;
            }
            window.location.href = url;
        });

        /* 状态搜索子菜单 */
        $(".search-form").find(".drop-down").hover(function () {
            $("#sub-sch-menu").removeClass("hidden");
        }, function () {
            $("#sub-sch-menu").addClass("hidden");
        });
        $('#time-start').datetimepicker({
            format: 'yyyy-mm-dd',
            language:"zh-CN",
            minView:2,
            autoclose:true
        });

        $('#time-end').datetimepicker({
            format: 'yyyy-mm-dd',
            language:"zh-CN",
            minView:2,
            autoclose:true
        });
    </script>
@endsection
